<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="课程号">
        <el-input v-model="form.courseId" type="textarea" />
      </el-form-item>
      <el-form-item label="课程名">
        <el-input v-model="form.courseName" type="textarea" />
      </el-form-item>
      <el-form-item label="任课老师">
        <el-input v-model="form.CourseTeacher" type="textarea" />
      </el-form-item>
      <el-form-item label="学分">
        <el-input v-model="form.credit" type="textarea" />
      </el-form-item>
      <el-form-item label="上课地点">
        <el-input v-model="form.coursePlace" type="textarea" />
      </el-form-item>
      <el-form-item label="上课时间">
        <el-input v-model="form.courseTime" type="textarea" />
      </el-form-item>
      <el-form-item label="学生人数">
        <el-input v-model="form.courseNumber" type="textarea" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit(form)">确认</el-button>
        <el-button @click="onCancel">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

  import { updateRow } from "../../../api/table";

export default {
  data() {
    return {
      form: {
        CourseNumber: '',
        CourseName: '',
        CourseTeacher: '',
        Credit:'',
        ClassPlace: '',
        ClassTime: '',
        StudentNumber:''
      },
    }
  },
  methods: {

    onSubmit(form) {
      updateRow(form).then((res) => {
        console.log(res);
        console.log(this.form);
        alert("hhhhh")
      });

      this.$message('submit!');
      //console.log(this.form)

    },
    onCancel() {

      this.$message({
        message: 'cancel!',
        type: 'warning'
      })
    }
  }
}
</script>

<style scoped>
.line{
  text-align: center;
}
</style>

